function initial() {

	var password=$("#xmlPasswordType").val();
	$("option ").each(function(k, v) {
		
		if ($(this).val() == password) {
			$(this).prop("selected", true);
		}
	});

	$("#passwordTypeOption").attr("disabled", "true");
}

function save() {

	$("#save")
			.click(

					function() {
						var element = document.getElementById('passwordTypeOption');

						DataSend = {
							"userName" : $("#userName").val(),
							"password" : $("#password").val(),
							"passwordType" : element.value
						};

						$.ajax({
							url : "http://localhost:8080/ConverstionTool/rest/config/UserNamePassword",
							dataType : "JSON",
							data : DataSend,
							type : "post",
						})

						$("#userName").attr("disabled", "true");
						$("#password").attr("disabled", "true");
						$("#passwordTypeOption").attr("disabled", "true");
					});
}

function edit() {
	$("#edit").click(function() {
		$("#userName").removeAttr("disabled");
		$("#password").removeAttr("disabled");
		$("#passwordTypeOption").removeAttr("disabled");

	})
}

$(function() {
	initial();
	save();
	edit();
})